#ifndef __DYNAMICARRAY_H__
#define __DYNAMICARRAY_H__
#define true 1
#define false 0
#define ELementType int
#define FreeArrayPoint(name)    if(name!=NULL){free(name);name=NULL;}
struct DynamicArray
{

    ELementType* dp;
    int Size;
    int len;
};


extern int InitArray(struct DynamicArray* arr, int count);
extern void FreeArray(struct DynamicArray* arr);
extern void Travel(struct DynamicArray* arr);
extern void InsertTail(struct DynamicArray* arr, ELementType element);
extern void InsertHead(struct DynamicArray* arr, ELementType element);
extern void InsertIndex(struct DynamicArray* arr, ELementType element, int index);
extern struct DynamicArray* MergeArray(struct DynamicArray* arr1, struct DynamicArray* arr2);
extern struct DynamicArray* FindUnionSet(struct DynamicArray* arr1, struct DynamicArray* arr2);
extern void Deduplication(struct DynamicArray* arr);
extern void Quick_Sort(int* arr, int begin, int end);
extern struct DynamicArray* FindIntersection(struct DynamicArray* arr1, struct DynamicArray* arr2);
extern void SetValueByElement(struct DynamicArray* arr, ELementType oldValue, ELementType newValue);
extern void SetValueByIndex(struct DynamicArray* arr, int index, ELementType element);
extern ELementType* FindByElementPlus(struct DynamicArray* arr, ELementType element);
extern ELementType* FindByElement(struct DynamicArray* arr, ELementType element);
extern ELementType* FindByIndex(struct DynamicArray* arr, int index);
extern void RemoveByElement(struct DynamicArray* arr, ELementType element);
extern void RemoveByIndex(struct DynamicArray* arr, int index);


#endif